home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.multimedia;
-
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class MovingAnimation extends Animator implements Runnable {
- int loopslot = 0;
- int shiftOffset = 10;
- private int curOffset = 0;
-
- public MovingAnimation() {
- super.forever = true;
- }
-
- public void setShiftOffset(int var1) {
- this.shiftOffset = var1;
- }
-
- public int getShiftOffset() {
- return this.shiftOffset;
- }
-
- public void run() {
- Thread.currentThread().setPriority(4);
- Dimension var1 = ((Component)this).size();
- int var2 = super.images.size();
- if (var2 > 1) {
- if (this.shiftOffset < 0) {
- this.curOffset = var1.width - super.maxWidth;
- }
-
- int var3 = 0;
-
- while(true) {
- if (++this.loopslot >= var2) {
- ++var3;
- if (var3 > super.numLoops && !super.forever) {
- break;
- }
-
- this.loopslot = 0;
- this.curOffset += this.shiftOffset;
- if (this.curOffset < 0) {
- this.curOffset = var1.width - super.maxWidth;
- } else if (this.curOffset + super.maxWidth > var1.width) {
- this.curOffset = 0;
- }
- }
-
- ((Component)this).repaint();
-
- try {
- Thread.sleep((long)super.delay);
- } catch (InterruptedException var4) {
- return;
- }
- }
- }
-
- }
-
- public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- if ((var2 & 56) != 0 && super.images != null && this.loopslot < super.images.size() && ((AnimatorImage)super.images.elementAt(this.loopslot)).image == var1) {
- ((Component)this).repaint(100L);
- }
-
- return (var2 & 96) == 0;
- }
-
- public void paint(Graphics var1) {
- if (super.images != null && this.loopslot < super.images.size()) {
- Image var2 = ((AnimatorImage)super.images.elementAt(this.loopslot)).image;
- if (var2 != null) {
- var1.drawImage(var2, this.curOffset, 0, this);
- }
- }
-
- }
- }
-